using System;

#if NETDUINOGO
namespace NetduinoGo.Modules.PeteBrown
#elif NETDUINO
namespace Netduino.Modules.PeteBrown
#elif GADGETEER
namespace Gadgeteer.Modules.PeteBrown
#endif
{

    /// <summary>
    /// MIDI Messages as defined here: http://www.midi.org/techspecs/midimessages.php 
    /// </summary>
    public enum MidiMessageId
    {
        Invalid = 0x00,
	    ChannelNoteOff = 0x80,
        ChannelNoteOn = 0x90,
        ChannelPolyPressure = 0xA0,
        ChannelControlChange = 0xB0,
        ChannelProgramChange = 0xC0,
        ChannelPressure = 0xD0,
        ChannelPitchWheel = 0xE0,
        //SysEx = 0xF0,
        //CommonTimeCodeQuarterFrame = 0xF1,
        //CommonSongPosition = 0xF2,
        //CommonSongSelect = 0xF3,
        //CommonTuneRequest = 0xF6,
        //RealTimeClock = 0xF8,
        //RealTimeStart = 0xF9,
        //RealTimeContinue = 0xFA,
        //RealTimeContinue = 0xFB,
        //RealTimeStop = 0xFC,
        RealTimeActiveSensing = 0xFE
        //RealTimeSystemReset = 0xFF
    };


    /// <summary>
    /// A message defined by the MIDI specification
    /// </summary>
    public struct MidiMessage
    {
        /// <summary>
        /// The channel for this message
        /// </summary>
        public MidiChannel Channel;

        /// <summary>
        /// The specific MIDI ID of this message.
        /// </summary>
        public MidiMessageId ID;
        //public byte ID;

        /// <summary>
        /// How many data bytes this message has (typically 1 or 2)
        /// </summary>
        public byte DataByteCount;

        /// <summary>
        /// The first data byte. Check the data byte count before reading this value.
        /// </summary>
        public byte DataByte1;

        /// <summary>
        /// The second data byte. Check the data byte count before reading this value.
        /// </summary>
        public byte DataByte2;
    }
}
